package org.common.utils.config.handler;

import org.common.utils.config.ConfigInfo;
import org.common.utils.config.ConfigObject;
import org.common.utils.config.ConfigType;
import org.common.utils.tool.EnvTool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Map;

/**
 * 环境变量配置处理器
 * @author zhouzhibing
 * @date 2025/7/29
 */
public class EnvHandler extends AbstractConfigHandler {

    private static final Logger log = LoggerFactory.getLogger(EnvHandler.class);


    public EnvHandler() {
        super(ConfigType.ENV);
    }

    @Override
    protected boolean loadImpl(ConfigObject configObject , ConfigInfo configInfo , Map<String , String> configMap) {
        Map<String, String> allEnv = EnvTool.getAllEnv();
        configMap.putAll(allEnv);
        log.info("EnvHandler.loadImpl success , allEnvSize = {} ", allEnv.size());
        return true;
    }
}
